package com.company.biz.user.action;

import com.company.biz.user.service.AreaService;
import com.company.user.entity.AreaEntity;
import com.company.user.req.AreaIdReq;
import com.company.user.vo.GeneralResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(description = "地区管理")
@RequestMapping("/area")
@RestController
public class AreaController extends BaseController {

    @Resource
    private AreaService areaService;

    @ApiOperation(value = "获取改地区的子地区，若获取省份 传none")
    @RequestMapping(value = "/getChildrenAreaListByAreaId", method = RequestMethod.POST)
    public GeneralResult<List<AreaEntity>> getChildrenAreaListByAreaId(@RequestBody AreaIdReq req) {
        List<AreaEntity> areaEntities = areaService.getChildrenAreaListByAreaId(req.getAreaId());
        return GeneralResult.genSuccessResult(areaEntities);
    }


}
